package com.hs.singleton;

/**
 * @Author: hs
 * @Description:  类的加载  与 初始化<clinit>  是分开的
 * @Date: Create in 22:05 2019/7/28
 */
public class SingletonHungry {
    public final static String hungry = new String ("hungry");
    public final static SingletonHungry instance = new SingletonHungry();
    //private static SingletonHungry instance = new SingletonHungry();
    static{
        System.out.println("饿汉模式");
    }
    private SingletonHungry() {}
    public static SingletonHungry getInstance(){
        return instance;
    }
}
